local skill = fk.CreateSkill {
  name = "lvshi__jincui",
  tags = {"Turn"}
}

Fk:loadTranslationTable{
  ["lvshi__jincui"] = "尽瘁",
  [":lvshi__jincui"] = "回合技，你可将牌堆底的一张牌当【闪】或【无懈可击】使用，若与之类别不同，你失去1点体力并获得此牌。",
  ["#lvshi__jincui"] = "你可将牌堆底牌当【闪】或【无懈可击】使用，若类别不同，你失去1点体力并获得之",

  ["$lvshi__jincui1"] = "战群儒，守空城，今摆乱石八阵，笑谈将军死生。",
  ["$lvshi__jincui2"] = "汝等多虑，正中下怀。",
}


skill:addEffect("viewas", {
  prompt = "#lvshi__jincui",
  pattern = "jink,nullification",
  card_filter = Util.FalseFunc,
  view_as = function(self, player, cards)
    if #cards ~= 0 then return nil end
    local card = Fk:cloneCard("lvshi__jink")
    if Fk.currentResponsePattern == "nullification" then
      card = Fk:cloneCard("lvshi__nullification")
    end
    card.skillName = skill.name
    return card
  end,
  enabled_at_play = Util.FalseFunc,
  enabled_at_response = function(self, player, response)
    if response then return false end
    return player:usedSkillTimes(skill.name) == 0
  end,
  before_use = function(self, player, use)
    local room = player.room
    local ids = room:getNCards(1, "bottom")
    use.card:addSubcards(ids)
  end,
  after_use = function(self, player, use) 
    if use.card.type ~= Fk:getCardById(use.card.subcards[1]).type then
      player.room:obtainCard(player.id, use.card, true, fk.ReasonJustMove)
      player.room:loseHp(player, 1, skill.name)
    end
  end,
})

return skill
